#include "UdpServer.hpp"
#include "MessageRoute.hpp"
#include <unistd.h>
#include <memory>
#include <functional>

using namespace std;

void Usage(string proc)
{
    cout << "Usage: " << proc << " + port" << endl;
}
int main(int argc, char *argv[])
{
    if(argc != 2)
    {
        Usage(argv[0]);
        exit(1);
    }
    EnableScreen();
    uint16_t serverport = stoi(argv[1]);

    MessageRoute route;

    unique_ptr<UdpServer> us = make_unique<UdpServer>(serverport,
     bind(&MessageRoute::Route, &route, placeholders::_1, placeholders::_2 ,placeholders::_3));
    us->InitServer();
    us->Start();

    return 0;
}